<div ng-include="sys_html('common/_header')"></div>
<style>
.cartmode{
	bottom: 2.5rem
}
.fui-number .minus:before, .fui-number .plus:before {
	border-left: 0 solid #d9d9d9;
}
.fui-number .minus:after, .fui-number .plus:after {
	border-right: 0 solid #d9d9d9;
}
.fui-number:before {
	border-top: 0 solid #d9d9d9;
}
.fui-number:after {border-top: 0 solid #d9d9d9;}
.fui-number .num {
	color:#666;
}
.fui-number .num {
	color:#666;
}
.fui-number.small {
	height: 1.2rem;
	width: auto;
	line-height: 1.2rem;
}
.fui-number .minus, .fui-number .plus {
	z-index:0;
}
.fui-number.small .minus{
	color: {{main.syscolor || '#63BE72'}};
	padding-top:1px;
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
 .fui-number.small .plus {
	color: #fff;
	padding-top:1px;
	background: {{main.syscolor || '#63BE72'}};
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
.jy2-headertop {position: absolute; min-height: 100%;padding-top:0.3rem;padding-bottom:0.3rem;margin-top:-2rem;border-top-right-radius:1rem;border-top-left-radius:1rem;}
.fui-header a.back:before {
	border-color: #fff
}
.fui-header:after {
	border-bottom: 0 solid #D9D9D9;
}
.fui-navbar .cartbtn {padding-right:0.3rem;background:#fff;opacity:1}
.fui-navbar .buybtn  {padding-left:0.3rem;background:#fff}
.fee-tag-nav, .fee-tagup-nav, .fee-disabled-nav {border-radius:1rem;height:2rem;line-height:1.95rem;color:#fff;width:100%;font-weight:400;font-size:0.7rem;margin:0.2rem 0;padding:0 0.2rem;text-align:center}
.fee-tagup {background:{{main.syscolor || 'red'}};color:#fff;width:auto;font-weight:400;font-size:0.55rem}
.fee-tag-nav ,.merchfee-tag-nav{background:{{main.syscolor || 'red'}}; opacity: 0.58;}
.merchfee-tag-nav, .merchfee-tagup-nav, .merchfee-disabled-nav {
    border-radius: 1rem;
    line-height: 1.5rem;
    color: #fff;
    width: 100%;
    font-weight: 400;
    font-size: 0.7rem;
    margin: 0.2rem 0;
    padding: 0 0.5rem;
    text-align: center;
}
.fee-tagup-nav, .merchfee-tagup-nav {background:{{main.syscolor || 'red'}};}
.fee-disabled-nav, .merchfee-disabled-nav {background:#bbb;color:#fff;}	
.coutag {padding:0.1rem 0.2rem;background:#ffedef;color:#db2e2a;font-size:0.55rem;border-radius: 0.2rem;}
input[type=checkbox],input[type=radio] {
	min-width: 0.9rem;
    min-height: 0.9rem;
    line-height: 0.9rem;
    margin-right: 0.5rem;
}
input[type="checkbox"]::before {
    border-radius: 100%;
}
input[type="checkbox"]:checked::before,input[type="radio"]:checked::before {
   border-radius: 100%;
}
.member-cart-page .fui-list-media img {
    width: 2.5rem;
    height: 2.5rem;
}
.fui-checkbox.fui-checkbox-danger:checked, .fui-radio.fui-radio-danger:checked {
    background: none;
    border: 0 solid red;
}
</style>
<div class='fui-page  fui-page-current member-cart-page'>
	<div class="topbg" style="position: relative;text-align:center;width:100%;height:4.5rem;background: {{main.syscolor || '#7c1cc9'}};">
			<div class="fui-header" style="background:none">
				<div class="fui-header-left">
					<a class="back" style="color:#fff" href="javascript:" ng-click="goback()"></a>
				</div>
				<div class="title bold" style="font-size:1rem;color:#fff">标签打印</div>
				<div class="fui-header-right" style="padding-right:0.5rem;color:#fff">
				</div>
			</div>
	</div>
	<div class="fui-content jy2-headertop cart-list" style="background:#f7f7f7">
		<div id="cart_container" style="padding-bottom:5rem">
			<div ng-if="pagedata.list.length<=0 && pagedata.loaded" class="content-empty">
				<img src="../addons/jy_weishop/images/nogoods.png" style="width: 6rem;margin-bottom: .5rem;">
				<br/>
				<p style="color: #999;font-size: .75rem">暂时没有需要打印的商品标签！</p>
			</div>
			<div class="radius" style="padding:0.2rem 0.5rem;">
			<div ng-if="pagedata.print_pcd!=1" ng-include="sys_html('manage/_allsend')"></div>
			<div ng-if="pagedata.print_pcd==1" ng-include="sys_html('manage/_ordersend')"></div>
			
			</div>
		</div>
		<div id="footer_container">
		<div ng-if="pagedata.list.length>0" class="fui-footer">
			<div class="fui-list noclick">
				<div class="fui-list-media">
					<label class="checkbox-inline checkall" style="margin-right:.8rem">
						<input type="checkbox" ng-checked="pagedata.isselectall==1" name="checkbox" class="fui-radio fui-radio-danger" style="margin-top:-0.1rem" ng-click="pagedata.selectall();"/>&nbsp;全选
					</label>
				</div>
				<div class="fui-list-inner">
					<div class='subtitle l' style="font-size:0.7rem;padding-bottom:0.15rem">
					<span class="bigprice" style="font-weight:600"> 打印</span>
					<span class='totalprice  bigprice' style="font-weight:600;">{{pagedata.total}}</span>
					</div>
				</div>
				<div class='fui-list-angle' style="padding-left:2px;padding-right:0.5rem">
					<div ng-if="pagedata.print_pcd!=1" ng-click="pagedata.print()" ng-class="{'fee-disabled-nav':pagedata.total<=0,'fee-tag-nav':pagedata.total>0}">
							打印
					</div>
					<div ng-if="pagedata.print_pcd==1" ng-click="pagedata.print(1)" ng-class="{'fee-disabled-nav':pagedata.total<=0,'fee-tag-nav':pagedata.total>0}">
							打印
					</div>
				</div>
			</div>
		</div>
		</div>
</div>
</div>
<script>
//减少
scope.pagedata.minus=function(index){
	if(scope.pagedata.list[index].printnum<=0){
		scope.message('不能再减了！');
		return false;
	}
	scope.pagedata.list[index].printnum--
	scope.pagedata.refresh();
}
//增加
scope.pagedata.plus=function(index){
	if(scope.pagedata.list[index].printnum>=scope.pagedata.list[index].lastprintnum){
		scope.message('不能再加了！');
		return false;
	}
	scope.pagedata.list[index].printnum++
	scope.pagedata.refresh();
}
//选择
scope.pagedata.toogle_select=function(index){
	var cart=scope.pagedata.list[index];
	var selected=cart.selected==1?0:1;
	scope.pagedata.list[index].selected=selected
	scope.pagedata.refresh();
}
//选择
scope.pagedata.selectall=function(){
	for(var i=0;i<scope.pagedata.list.length;i++){
		scope.pagedata.list[i].selected=scope.pagedata.list[i].selected==1?0:1;
	}
	scope.pagedata.refresh();
}
//刷新总数和总价
scope.pagedata.refresh=function(){
	var total=0;
	for(var i=0;i<scope.pagedata.list.length;i++){
	   var selected=scope.pagedata.list[i].selected;
		if(selected){
			total +=scope.pagedata.list[i].printnum*1;
		}
	}
	scope.pagedata.total=total;
	scope.$evalAsync();
}

scope.pagedata.print=function(print_pcd){
	if(scope.pagedata.total<=0){
		scope.message('请选择打印！');
		return false;
	}
	print_pcd=print_pcd?print_pcd:0;
	scope.post_json('jy_supplier/manage.printgoods/print/print_pcd='+print_pcd,scope.pagedata.list);
}
scope.pagedata.goodsprint=function(logid,goodskey){
	if(!logid){
		scope.message('请选择打印！');
		return false;
	}
	scope.post_json('jy_supplier/manage.printgoods/goodsprint/logid='+logid+'&goodskey='+goodskey);
}
if(scope.pagedata.print_pcd==1){
	scope.tool.get_list('/manage.printgoods/list/',true,function(res){
		scope.pagedata.total=scope.pagedata.list.length;
	});
	scope.pagedata.scroll_bottom=function(){
		scope.tool.get_list('/manage.printgoods/list/');
	}
}
</script>
